<template>
  <div>
<van-nav-bar
  title="房屋管理"
  left-arrow
  @click-left="onClickLeft"
/>
<div class="box" v-if="isshow">
  <div class="pic">
    <img src="../assets/house.png" alt="">
  </div>
  <p>您还没有房源,<a href="#/detail" >去发布房源</a>吧~</p>
</div>
<listqq :list='list'></listqq>
  </div>
</template>

<script>
import requset from '@/utils/requset'
import listqq from '../components/listqq.vue'
export default {
  name: 'VueHaowuFavorate',
  components: {
    listqq
  },
  data () {
    return {
      list: []
    }
  },
  created () {
    this.getCollect()
  },
  computed: {
    isshow () {
      if (this.list.length !== 0) {
        return false
      } else {
        return true
      }
    }
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    },
    async getCollect () {
      const res = await requset({
        url: '/user/houses'
      })
      this.list = res.body
    }
  }
}
</script>

<style lang="less" scoped>
/deep/ .van-nav-bar__content {

  background-color: #21b97a;
  .van-nav-bar__left {
    .van-icon  {
      color: #fff;
    }
  }
  .van-nav-bar__title{
  color: #fff;
  }
}
.box {
  display: flex;
  flex-direction:column;
  .pic {
    img {
      width: 100%;
    }
  }
  p {
   margin-left:90px;
  }
}
</style>
